﻿@model SubmitReturnRequestModel
@using Nop.Web.Models.Order;
@{
    Layout = "~/Views/Shared/_ColumnsOne.cshtml";

    //title
    Html.AddTitleParts(T("PageTitle.ReturnItems").Text);
}
<div class="page return-request-page">
    <div class="page-title">
        <h1>@string.Format(T("ReturnRequests.Title").Text, Model.OrderId)</h1>
    </div>
    <div class="page-body">
        @if (!String.IsNullOrEmpty(Model.Result))
        {
            <div class="result">
                @Model.Result
            </div>
        }
        else
        {
            using (Html.BeginForm())
            {
            <div class="section">
                <div class="title">
                    <strong>@T("ReturnRequests.SelectProduct(s)")</strong>
                </div>
                <table class="data-table">
                    <colgroup>
                        <col />
                        <col />
                        <col width="1" />
                    </colgroup>
                    <thead>
                        <tr>
                            <th class="a-center name">
                                @T("ReturnRequests.Products.Name")
                            </th>
                            <th class="a-center price">
                                @T("ReturnRequests.Products.Price")
                            </th>
                            <th class="a-center quantity">
                                @T("ReturnRequests.Products.Quantity")
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model.Items)
                        {   
                            <tr>
                                <td class="a-left name">
                                    <a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })">@item.ProductName</a>
                                    @if (!String.IsNullOrEmpty(item.AttributeInfo))
                                    {
                                        <div class="attributes">
                                            @Html.Raw(item.AttributeInfo)
                                        </div>
                                    }
                                </td>
                                <td class="a-left price">
                                    @item.UnitPrice
                                </td>
                                <td class="a-left quantity">
                                    <select name="quantity@(item.Id)">
                                        @for (int i = 0; i <= item.Quantity; i++)
                                        {
                                            <option value="@(i)">@(i)</option>
                                        }
                                    </select>
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            
            <div class="fieldset">
                <div class="title">
                    <strong>@T("ReturnRequests.WhyReturning")</strong>
                </div>
                <div class="form-fields">
                    <div class="inputs">
                        @Html.LabelFor(model => model.ReturnReason, new { }, ":")
                        @Html.DropDownListFor(model => model.ReturnReason, Model.AvailableReturnReasons, new { @class = "return-reasons" })
                    </div>
                    <div class="inputs">
                        @Html.LabelFor(model => model.ReturnAction, new { }, ":")
                        @Html.DropDownListFor(model => model.ReturnAction, Model.AvailableReturnActions, new { @class = "return-actions" })
                    </div>
                    <div class="inputs">
                        @Html.LabelFor(model => model.Comments, new { }, ":")
                        @Html.TextAreaFor(model => model.Comments, new { @class = "comment" })
                        @Html.ValidationMessageFor(model => model.Comments)
                    </div>
                </div>
            </div>
            <div class="buttons">
                <input type="submit" name="submit-return-request" class="button-1 submit-return-request-button" value="@T("ReturnRequests.Submit")" />
            </div>
            }
        }
    </div>
</div>
